Polyp | a Polytypic Programming Language Extension

نویسنده

  • Johan Jeuring
چکیده

Many functions have to be written over and over again for di erent datatypes, either because datatypes change during the development of programs, or because functions with similar functionality are needed on di erent datatypes. Examples of such functions are pretty printers, debuggers, equality functions, uni ers, pattern matchers, rewriting functions, etc. Such functions are called polytypic functions. A polytypic function is a function that is de ned by induction on the structure of user-de ned datatypes. This paper extends a functional language (a subset of Haskell) with a construct for writing polytypic functions. The extended language type checks de nitions of polytypic functions, and infers the types of all other expressions using an extension of Jones' theories of quali ed types and higher-order polymorphism. The semantics of the programs in the extended language is obtained by adding type arguments to functions in a dictionary passing style. Programs in the extended language are translated to Haskell.

برای دانلود رایگان متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Polytypic Functional Programming

Structural polymorphism is a generic programming technique known within the functional programming community under the names of polytypic or datatype-generic programming. In this thesis we show that such a technique conflicts with the principle of data abstraction and propose a solution for reconciliation. More concretely, we show that popular polytypic extensions of the functional programming ...

متن کامل

Polytypic Compact Printing and Parsing

A generic compact printer and a corresponding parser are constructed These programs transform values of any regular datatype to and from a bit stream The algorithms are constructed along with a proof that printing followed by parsing is the identity Since the binary representation is very compact the printer can be used for compressing data possibly supplemented with some standard algorithm for...

متن کامل

Type-safe run-time polytypic programming

Polytypic programming is a way of defining type-indexed operations, such as map, fold and zip, based on type information. Run-time polytypic programming allows that type information to be dynamically computed—this support is essential in modern programming languages that support separate compilation, first-class type abstraction, or polymorphic recursion. However, in previous work we defined ru...

متن کامل

Polytypic Functions Over Nested Datatypes

The theory and practice of polytypic programming is intimately connected with the initial algebra semantics of datatypes. This is both a blessing and a curse. It is a blessing because the underlying theory is beautiful and well developed. It is a curse because the initial algebra semantics is restricted to so-called regular datatypes. Recent work by R. Bird and L. Meertens [3] on the semantics ...

متن کامل

Polytypic Programming in Haskell

A polytypic (or generic) program captures a common pattern of computation over di erent datatypes by abstracting over the structure of the datatype. Examples of algorithms that can be de ned polytypically are equality tests, mapping functions and pretty printers. A commonly used technique to implement polytypic programming is specialization, where a specialized version of a polytypic function i...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 1997